#include <iostream>
#include <vector>
using namespace std;

int min_time(vector<int> &book, int k)
{
        int n = book.size();
        vector<vector<int>> dp(k + 1, vector<int>(n, INT32_MAX));
        vector<int> sum(n, 0);
        for(int i = 1; i < n; i++){
                sum[i] = sum[i - 1] + book[i];
        }
        dp[0][0] = 0;

        int stm = 0;
        for(int i = 1; i <= k; i++){
                for(int j = 1; j < n; j++){
                        for(int l = 1; l <= j; l++){
                                stm = sum[j] - sum[j - l];
                                stm = max(stm, dp[i - 1][j - l]);
                                dp[i][j] = min(stm, dp[i][j]);
                        }
                }
        }
        return dp.back().back();
}

int show(vector<vector<int>> &bk, int n, int m)
{
        if(n == 1){
                cout<<1<<" "<<m<<endl;
                return bk[n][m];
        }

        show(bk, n - 1, m - bk[n][m]);
        cout<<m - bk[n][m] + 1<<" "<<m<<endl;
        return 0;
}

int print_ans(vector<int> &book, int val, int k)
{
        vector<int> cnt(k + 1, 0);
        int n = book.size() - 1;
        int kk = k;
        while(k){
                int value = val;
                while( n > 0 && (value -= book[n]) >= 0){
                        n--;
                        cnt[k]++;
                }
                k--;
        }
        int start = 1;
        k = kk;
        for(int i = 1; i <= k; i++){
                cout<<start<<' '<<(start + cnt[i] - 1)<<endl;
                start += cnt[i];
        }
        return 0;
}

int main()
{
        int m, k;
        cin>>m>>k;
        vector<int> book(m + 1, 0);
        for(int i = 1; i <= m; i++){
                cin>>book[i];
        }

        int val = min_time(book, k);
        //show(back, k, m);
        print_ans(book, val, k);
        return 0;
}